﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Vds2465Telegrams
{
	[TestClass]
	public class UserData_73_TelegramCounter_Test
	{
		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test01_Equals()
		{
			UserData_73_TelegramCounter userData = new UserData_73_TelegramCounter(0x99, 0x34);

			{
				// completely different type - NOT equal
				object dummyObject = new object();
				Assert.IsFalse(userData.Equals(dummyObject));
			}

			{
				// different derived type 
				UserData_11_Error userData2Compare = new UserData_11_Error(eErrorCode.DataOutOfRange, 0x99);
				Assert.IsFalse(userData.Equals(userData2Compare));
			}

			{
				// same object - equal
				UserData_73_TelegramCounter userData2Compare = new UserData_73_TelegramCounter(userData.Device, userData.Counter);
				Assert.IsTrue(userData.Equals(userData2Compare));
			}

			{
				// different property values - NOT equal                
				UserData_73_TelegramCounter userData2Compare = new UserData_73_TelegramCounter((byte)(userData.Device + 1), userData.Counter);
				Assert.IsFalse(userData.Equals(userData2Compare));
			}

			{
				// different property values - NOT equal                
				UserData_73_TelegramCounter userData2Compare = new UserData_73_TelegramCounter(userData.Device, (byte)(userData.Counter + 1));
				Assert.IsFalse(userData.Equals(userData2Compare));
			}
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test02_GetHashCode()
		{
			UserData_73_TelegramCounter userData = new UserData_73_TelegramCounter(0xef, 0x56);
			int hashCode01 = userData.GetHashCode();
		}

		[TestMethod]
		[Owner("Frank Eppink")]
		public void Test03_ToString()
		{
			UserData_73_TelegramCounter userData = new UserData_73_TelegramCounter(0x51, 0x23);
			string string01 = userData.ToString();
			Assert.IsNotNull(string01);
		}
	}
}
